(SST) ShlWAPI.pas Version 1.08

Developer Reference
(SST)ShlWAPI PathQuoteSpaces Function
Adds quotation marks to both ends of a string if this contains blanks/spaces.
Scope
Global (i.e. this function can be called/accessed from code in any unit that includes/uses (SST)ShlWAPI.pas).
Syntax
Function PathQuoteSpaces(lpsz : LPSTR) : BOOL;
Parameters
lpsz [in/out] Depending on which version of the function is called, a pointer to the buffer containing either the ANSI or Unicode string to be modified.
Return Values
Returns TRUE if quotation marks were added to the string, FALSE, if not (but see remarks, below).
Remarks
Up to, and including MS SDK version 6.0, this function was declared and documented as a procedure (i.e. as a function that does not return a value to the caller directly, commonly thru/via a CPU register). In version 6.1 of the MS SDK however, it is declared and documented as a function returning a BOOL value. This suggests that either, there was an error in the previous declaration, or that the function underwent substantial modifications.
Example
PROCEDURE TForm4.TestShlWAPIPathQuoteSpaces(Sender : TObject);

VAR pathbuf : ARRAY[0..MAX_PATH] OF CHAR;
VAR apiretval : BOOL;
VAR newinfoline : STRING;

  BEGIN
FillChar(pathbuf, Length(pathbuf), #0);
apiretval := FALSE;
newinfoline := '';

pathbuf := 'C:\Hello World !';
newinfoline := 'PathQuoteSpaces called with ' + pathbuf;
Memo1.Lines.Add(newinfoline);
apiretval := PathQuoteSpaces(pathbuf);
IF apiretval THEN
newinfoline := 'TRUE ' + pathbuf
ELSE
newinfoline := 'FALSE';
Memo1.Lines.Add(newinfoline);

pathbuf := 'C:\Hello\World';
newinfoline := 'PathQuoteSpaces called with ' + pathbuf;
Memo1.Lines.Add(newinfoline);
apiretval := PathQuoteSpaces(pathbuf);
IF apiretval THEN
newinfoline := 'TRUE ' + pathbuf
ELSE
newinfoline := 'FALSE';
Memo1.Lines.Add(newinfoline);

Memo1.Lines.Add('');

pathbuf := 'C:\Program Files\Windows Mail\wab.exe -DummyParam /a "DummyParam2"';
newinfoline := 'PathQuoteSpaces called with ' + pathbuf;
Memo1.Lines.Add(newinfoline);
apiretval := PathQuoteSpaces(pathbuf);
IF apiretval THEN
newinfoline := 'TRUE ' + pathbuf
ELSE
newinfoline := 'FALSE';
Memo1.Lines.Add(newinfoline);
  END;
The above example produces the following output:
PathQuoteSpaces called with C:\Hello World !
TRUE "C:\Hello World !"
PathQuoteSpaces called with C:\Hello\World
FALSE
PathQuoteSpaces called with C:\Program Files\Windows Mail\wab.exe -DummyParam /a "DummyParam2"
TRUE "C:\Program Files\Windows Mail\wab.exe -DummyParam /a "DummyParam2""
Requirements
Unit: Declared and imported in (SST)ShlWAPI.pas
Library: (SST)ShlWAPI.dcu/(SST)ShlWAPI.obj
Unicode: Implemented as ANSI (PathQuoteSpaces and PathQuoteSpacesA) and Unicode (PathQuoteSpacesW) functions.
Min. ShlWAPI.dll version according to MS SDK doc.: 4.71
Min. ShlWAPI.dll version based on SST research: 4.71
Min. OS version(s) according to Microsoft SDK doc.: Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0.
Min. OS version(s) according to SST research.: Windows NT 4.0 with IE 4.0, Windows 95 with IE 4.0, Windows 98, Windows 2000 and later.
See Also
PathRemoveArgs, PathGetArgs, PathUnquoteSpaces.
 
Windows APIs: PathQuoteSpaces, PathUnquoteSpaces.


Document/Contents version 1.00
Page/URI last updated on 07.12.2023
 
Copyright © Stoelzel Software Technologie (SST) 2010 - 2017
Suggestions and comments mail to:
webmaster@stoelzelsoftwaretech.com